<?php

namespace app\admin\validate;

use think\Validate;

class SupplierBalanceWarningConfig extends Validate
{
    protected $rule = [
        'id' => 'require',
        'uniqueId' => 'require',
        'balance' => 'require|egt:-1000000|regex:-?\d{1,}([.]{1}[0-9]{1,2})?|elt:1000000',
        'mobile' => 'require',
        'status' => 'require|in:1,2',
    ];

    protected $message = [
        'id.require' => 'id不能为空',
        'uniqueId.require' => '请选择供应商',
        'balance.require' => '请填写余额预警值',
        'balance.regex' => '余额预警值格式有误',
        'balance.egt' => '余额预警值范围：-100万 ~ 100 万',
        'balance.elt' => '余额预警值范围：-100万 ~ 100 万',
        'mobile.require' => '请填写预警手机号',
        'status.require' => '请选择开启状态',
        'status.in' => '开启状态有误',
    ];

    protected $scene = [
        'create' => [
            'supplier_id',
            'serv_type',
            'balance',
            'mobile',
            'status',
        ],
        'changeStatus' => [
            'id',
            'status',
        ]
    ];
}
